<?php

declare(strict_types=1);

namespace App\Traits\Model\Shop;

use App\Model\App\App as AppModel;

trait Shop
{
    /**
     * 关联APP
     * @return \Hyperf\Database\Model\Relations\HasOne
     */
    public function app()
    {
        return $this->hasOne(AppModel::class);
    }

    /**
     * 查询店铺名称
     * @param $query
     * @param $value
     * @param string $alias
     */
    public function scopeName($query, $value, $alias='')
    {
        $query->where($this->getAlias($alias, 'name'), 'like', "%{$value}%");
    }
}
